@extends("admin.base.base")
@section("title")
    <title>用户列表</title>
    <link href="{{asset('css/admin/css/picture.css')}}" rel="stylesheet" type="text/css" />
    <link href="{{ asset('css/admin/css/paginate.css') }}" rel="stylesheet">
@endsection
@section("content")
    <nav class="breadcrumb"><i class="Hui-iconfont">&#xe67f;</i> 首页 <span class="c-gray en">&gt;</span> 用户管理<span class="c-gray en">&gt;</span> 用户列表 <a class="btn btn-success radius r" style="line-height:1.6em;margin-top:3px" href="javascript:location.replace(location.href);" title="刷新" ><i class="Hui-iconfont">&#xe68f;</i></a></nav>
    <div class="page-container">

        <div class="cl pd-5 bg-1 bk-gray mt-20">  <span class="r">共有数据：<strong>{{$item->total()}}</strong> 条</span> </div>
        <div class="mt-20">
            <form>
                <table class="table table-border table-bordered table-bg table-hover table-sort">
                    <thead>
                    <tr class="text-c">
                        <th width="20"><input name="" type="checkbox" value=""></th>
                        <th width="20">ID</th>
                        <th width="50">头像</th>
                        <th width="100">用户名</th>
                        <th width="100">手机号</th>
                        <th width="100">邮箱</th>
                        <th width="60">创建时间</th>
                        <th width="60">操作</th>
                    </tr>
                    </thead>
                    <tbody>
                    @foreach($item as $value)
                        <tr class="text-c">
                            <td><input name="" type="checkbox" value=""></td>
                            <td>{{$value->id}}</td>
                            <td><a><img width="50" height="50" class="picture-thumb" src="{{$value->avatar}}"></a></td>
                            <td>{{$value->name}}</td>
                            <td>{{$value->mobile}}</td>
                            <td>{{$value->email}}</td>
                            <td>{{$value->created_at}}</td>
                            <td class="td-manage">
                                {{csrf_field()}}
                                {{method_field('DELETE')}}
                                {{--<a style="text-decoration:none" class="ml-5" onClick="travels_show('查看','','')" href="javascript:;" title="查看"><i class="Hui-iconfont">&#xe665;</i></a>--}}
                                {{--<a style="text-decoration:none" class="ml-5" onClick="users_del(this,'{{$value->id}}')" href="javascript:;" title="删除"><i class="Hui-iconfont">&#xe6e2;</i></a>--}}
                            </td>
                        </tr>
                    @endforeach
                    </tbody>
                </table>
                <div class="pages">
                    {{$item->links()}}
                </div>
            </form>
        </div>
    </div>
@endsection
@section("js")
    <!--请在下方写此页面业务相关的脚本-->
    <script type="text/javascript" src="{{asset('lib/My97DatePicker/4.8/WdatePicker.js')}}"></script>
    <script type="text/javascript" src="{{asset('lib/datatables/1.10.0/jquery.dataTables.min.js')}}"></script>
    <script type="text/javascript" src="{{asset('lib/laypage/1.2/laypage.js')}}"></script>
    <script type="text/javascript">
        $('.table-sort').dataTable({
            "aaSorting": [[ 1, "desc" ]],//默认第几个排序
            "bStateSave": true,//状态保存
            "aoColumnDefs": [
                //{"bVisible": false, "aTargets": [ 3 ]} //控制列的隐藏显示
                {"orderable":false,"aTargets":[0,6]}// 制定列不参与排序
            ]
        });

        /*游记-查看*/
        function travels_show(title,url,id){
            var index = layer.open({
                type: 2,
                title: title,
                content: url
            });
            layer.full(index);
        }

        /*游记-删除*/
        function users_del(obj,id){
            layer.confirm('确认要删除吗？',function(index){
                $.ajax({
                    type: 'POST',
                    method:'DELETE',
                    url: '{{url('admin/user')}}'+'/'+id,
                    data:{'_token':'{{csrf_token()}}'},
                    dataType: 'json',
                    success: function(data){
                        if (data.code == 0){
                            $(obj).parents("tr").remove();
                            layer.msg(data.msg,{icon:1,time:1000});
                        }else {
                            layer.msg(data.msg);
                        }
                    }
                });
            });
        }
    </script>
@endsection